#include "honorwallwidget.h"
#include "ui_honorwallwidget.h"
#include <QVBoxLayout>
#include <QPushButton>
#include <QScrollArea>
#include <QGridLayout>

honorwallwidget::honorwallwidget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::honorwallwidget)
{
    ui->setupUi(this);
}

honorwallwidget::~honorwallwidget()
{
    delete ui;
}

void honorwallwidget::setupUI()
{
    // 主布局
    QVBoxLayout* mainLayout = new QVBoxLayout(this);

    // 按钮布局
    QHBoxLayout* buttonLayout = new QHBoxLayout;

    // 添加按钮
    addButton = new QPushButton("添加图片", this);
    // connect(addButton, &QPushButton::clicked, this, &honorwallwidget::addImage);
    buttonLayout->addWidget(addButton);

    // 修改按钮
    modifyButton = new QPushButton("修改图片", this);
    // connect(modifyButton, &QPushButton::clicked, this, &honorwallwidget::modifyImage);
    buttonLayout->addWidget(modifyButton);

    // 删除按钮
    deleteButton = new QPushButton("删除图片", this);
    // connect(deleteButton, &QPushButton::clicked, this, &honorwallwidget::deleteImage);
    buttonLayout->addWidget(deleteButton);

    mainLayout->addLayout(buttonLayout);

    // 滚动区域
    scrollArea = new QScrollArea(this);
    scrollArea->setWidgetResizable(true); // 允许内容区域调整大小
    // 内容区域
    contentWidget = new QWidget(scrollArea);
    gridLayout = new QGridLayout(contentWidget);
    contentWidget->setLayout(gridLayout);

    // 设置滚动区域的内容
    scrollArea->setWidget(contentWidget);
    mainLayout->addWidget(scrollArea);

    // 设置主布局
    setLayout(mainLayout);
}
